/**
 *
 *  Project      :  UVa's acm
 *  Project site :  code.google.com/p/uvaacm/
 *  Author       :  Ives Liao
 *  E-Mail       :  iveslazycat at gmail.com
 *  Date         :  2011/11/17
 *  Website      :  iveslazycat.pixnet.net
 *  
 */
#ifdef ONLINE_JUDGE /* If compiler is UVa's online judge */
    #include<stdio.h> /*Include standard header foe UVa's compiler */
    #include<math.h>
    #define INPUT stdin /* Define the input is from standard input */
#else
    #include"header.h" /* Include my own header */
    #define INPUT fptIn /* Define the input is from input file */
#endif
/*---------- Do sub function declare and general define below here ----------*/
    int isPrime(int num);
/*---------- Do sub function declare and general define above here ----------*/
#ifdef ONLINE_JUDGE
    int main() {/* main() for UVa's online judge */
#else
    int acm_10924() {/* function name for my own */
        printf("--acm_10924 begin here--\n");/* Print begining of problem */
        FILE *fptIn = fopen("Resource/acm_10924.txt","r");/* Open input file to test */
        if ( fptIn == NULL )/* Distinguish the fptInIn file is load success. */
        {
            printf("File acm_10924.txt load fail.\n");/* Telling user file loading failed. */
            printf("Program will exit.\n");/* Telling user function gonna end. */
            return EXIT_FAILURE;/* Return to problem selector(main) */
        }
#endif
/*---------- Do primary statment below here ----------*/
    char str[22];
    int  sumOfStr,i;
    while( fgets(str,22,INPUT) ){
        for( i = 0, sumOfStr = 0 ; i < 21 && str[i]!='\n' ; i = i + 1 ){
            if( str[i]>='a' && str[i]<='z'){
                sumOfStr = sumOfStr + ( str[i] -  'a' ) + 1;
            }
            if( str[i]>='A' && str[i]<='Z'){
                sumOfStr = sumOfStr + ( str[i] - 'A' ) + 27;
            }
        }
        /*printf("SumOfStr is %d\n",sumOfStr);*/
        if ( isPrime(sumOfStr) ){
            printf("It is a prime word.\n");
        }else{
            printf("It is not a prime word.\n");
        }
    }
/*---------- Do primary statment above here ----------*/
    #ifndef ONLINE_JUDGE/* If compiler isn't UVa's online judge */
        printf("--acm_10924 end here--\n");/* Print end of problem */
        fclose(fptIn);/* Close file */
    #endif
    return 0;
}
/*---------- Do sub function implement below here ----------*/
int isPrime(int num)
{
    int i = 2, IsPrime = 0;
    while (i < sqrt(num) && num%i != 0 ) {
        i = i + 1;
    }
    if( (num%i != 0 ) || num==2 ) {
        IsPrime = 1;
    }
    return IsPrime;
}
/*---------- Do sub function implement above here ----------*/
